﻿using System.Collections.Generic;

namespace XUJson2CS
{
    /**
     * 安全数组
     */
    public class XUSafeArray<T>
    {
        private List<T> data;

        public int Count { get { return data.Count; } }

        public XUSafeArray(List<T> array)
        {
            data = array ?? new List<T>();
        }

        public T Get(int index)
        {
            if (index >= 0 && index < data.Count)
            {
                return data[index];
            }
            return default;
        }
    }
}